package com.ruoyi.model.service.impl;

import java.util.List;
import com.ruoyi.common.utils.DateUtils;
import com.ruoyi.system.domain.SNUtil;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import com.ruoyi.model.mapper.ModelDetailsMapper;
import com.ruoyi.model.domain.ModelDetails;
import com.ruoyi.model.service.IModelDetailsService;

/**
 * 模型明细Service业务层处理
 * 
 * @author weihanqiang
 * @date 2025-08-04
 */
@Service
public class ModelDetailsServiceImpl implements IModelDetailsService 
{
    @Autowired
    private ModelDetailsMapper modelDetailsMapper;
    @Autowired
    private SNUtil snUtil;
    /**
     * 查询模型明细
     * 
     * @param modeldId 模型明细主键
     * @return 模型明细
     */
    @Override
    public ModelDetails selectModelDetailsByModeldId(Long modeldId)
    {
        return modelDetailsMapper.selectModelDetailsByModeldId(modeldId);
    }

    /**
     * 查询模型明细列表
     * 
     * @param modelDetails 模型明细
     * @return 模型明细
     */
    @Override
    public List<ModelDetails> selectModelDetailsList(ModelDetails modelDetails)
    {
        return modelDetailsMapper.selectModelDetailsList(modelDetails);
    }

    /**
     * 新增模型明细
     * 
     * @param modelDetails 模型明细
     * @return 结果
     */
    @Override
    public int insertModelDetails(ModelDetails modelDetails)
    {
        String model_detail_data_no = snUtil.generateSN("model_details","modeld_no","yyyy<<dd","MOD",4);
        modelDetails.setModeldNo(model_detail_data_no);
        modelDetails.setCreateTime(DateUtils.getNowDate());
        return modelDetailsMapper.insertModelDetails(modelDetails);
    }

    /**
     * 修改模型明细
     * 
     * @param modelDetails 模型明细
     * @return 结果
     */
    @Override
    public int updateModelDetails(ModelDetails modelDetails)
    {
        return modelDetailsMapper.updateModelDetails(modelDetails);
    }

    /**
     * 批量删除模型明细
     * 
     * @param modeldIds 需要删除的模型明细主键
     * @return 结果
     */
    @Override
    public int deleteModelDetailsByModeldIds(Long[] modeldIds)
    {
        return modelDetailsMapper.deleteModelDetailsByModeldIds(modeldIds);
    }

    /**
     * 删除模型明细信息
     * 
     * @param modeldId 模型明细主键
     * @return 结果
     */
    @Override
    public int deleteModelDetailsByModeldId(Long modeldId)
    {
        return modelDetailsMapper.deleteModelDetailsByModeldId(modeldId);
    }
}
